// import { getStore } from '@/util/store'

const dic = {
  inspect: [
    {
      label: '是',
      value: '1'
    },
    {
      label: '否',
      value: '2'
    }
  ]
}

export const option = function () {
  return {
    labelWidth: 120,
    emptyBtn: false,
    submitBtn: false,
    detail: ['view'].includes(this.type),
    column: [
      {
        label: '模版名称',
        prop: 'templateName',
        maxlength: 50,
        span: 8,
        rules: [
          {
            required: true,
            message: '模版名称',
            trigger: 'change'
          }
        ]
      },
      {
        label: '物料分类',
        prop: 'classifyCode',
        formslot: true,
        display: true,
        maxlength: 50,
        span: 8,
        rules: [
          {
            required: true,
            message: '请选择物料分类',
            trigger: 'change'
          }
        ]
      },
      {
        label: '模版编号',
        prop: 'templateCode',
        maxlength: 50,
        disabled: true,
        span: 8
      },
      {
        label: '应用说明',
        prop: 'explain',
        type: 'textarea',
        placeholder: '',
        maxlength: 500,
        minRows: 4,
        maxRows: 6,
        span: 24
      }
    ]
  }
}

export const templateOption = function () {
  return {
    dialogWidth: '50%',
    labelWidth: 160,
    refreshBtn: false,
    columnBtn: true,
    border: true,
    stripe: true,
    index: true,
    editBtn: true,
    delBtn: true,
    align: 'center',
    addBtn: !['view'].includes(this.type),
    menu: !['view'].includes(this.type),
    indexLabel: '序号',
    column: [
      {
        label: '检查项名称',
        prop: 'name',
        maxlength: 20,
        span: 24,
        rules: [
          {
            required: true,
            message: '请输入检查项名称',
            trigger: 'blur'
          }
        ],
        minWidth: 100
      },
      {
        label: '检查项内容',
        prop: 'content',
        placeholder: '',
        maxlength: 500,
        span: 24,
        rules: [
          {
            required: true,
            message: '请输入检查项内容',
            trigger: 'blur'
          }
        ],
        minWidth: 100
      },
      {
        label: '检查项标准',
        prop: 'standard',
        placeholder: '',
        maxlength: 500,
        span: 24,
        rules: [
          {
            required: true,
            message: '请输入检查项内容',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '是否需要检查结果',
        prop: 'checkResultFlag',
        span: 24,
        type: 'select',
        // remote: true,
        props: {
          label: 'label',
          value: 'value'
        },
        dicData:dic.inspect,
        rules: [
          {
            required: true,
            message: '请选择是否需要检查结果',
            trigger: 'change'
          }
        ],
        minWidth: 100
      },
      {
        label: '所属部门',
        prop: 'dept',
        type: 'tree',
        span: 24,
        dicData: [],
        props: {
          label: 'title'
        },
        checkStrictly: true,
        rules: [
          {
            required: true,
            message: '请选择所属部门',
            trigger: 'click'
          }
        ]
      },
      {
        label: '负责人',
        prop: 'principal',
        span: 24,
        formslot:true,
        rules: [
          {
            required: true,
            message: '请选择负责人',
            trigger: 'change'
          }
        ],
        minWidth: 100
      }
    ]
  }
}
